/*
 * Copyright 2008 Pavel Byles (pavelbyles@gmail.com)
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.pavco.caribbeanvisit.client.ui;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.pavco.caribbeanvisit.shared.models.Attraction;
import com.pavco.caribbeanvisit.shared.models.Tag;

public class SearchResult extends Composite {
  private final VerticalPanel vPanel = new VerticalPanel();
  private final HorizontalPanel hPanel = new HorizontalPanel();
  private final HorizontalPanel innerHpanel = new HorizontalPanel();
  private final HorizontalPanel tagPanel = new HorizontalPanel();
  private final HTML displayHtml = new HTML();
  private final HTML description = new HTML();
  private final Image resultIcon = new Image();

  public SearchResult(Attraction attraction) {
    hPanel.add(innerHpanel);
    innerHpanel.add(resultIcon);
    innerHpanel.add(displayHtml);
    vPanel.add(hPanel);
    vPanel.add(description);
    vPanel.add(tagPanel);
    vPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
    
    displayHtml.setText(attraction.getName());
    //description.setText(attraction.getDescription().toString());
    
    for (Tag t : attraction.getTags()) {
      tagPanel.add(new HTML(t.getName()));
    }
    
    initWidget(vPanel);
  }
  
  public void addTo(Panel panel) {
    // TODO: implement this
  }
  
  public void addTo(PavcoMap map) {
    
  }
}
